package com.aaa.behind.service.impl;

import com.aaa.entity.ViewZoneBusiness;
import com.aaa.behind.dao.ViewZoneBusinessMapper;
import com.aaa.behind.service.IViewZoneBusinessService;
import com.aaa.util.PageInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * VIEW 服务实现类
 * </p>
 *
 * @author whj
 * @since 2023-02-04
 */
@Service
public class ViewZoneBusinessServiceImpl extends ServiceImpl<ViewZoneBusinessMapper, ViewZoneBusiness> implements IViewZoneBusinessService {

    @Autowired
    private ViewZoneBusinessMapper viewZoneBusinessMapper;

    @Override
    public Page manageUnstockedStores(PageInfo pageInfo, ViewZoneBusiness viewZoneBusiness) {
        QueryWrapper queryWrapper = new QueryWrapper();
        if (viewZoneBusiness.getSname() != null){
            queryWrapper.like("sname",viewZoneBusiness.getSname());
        }
        if (viewZoneBusiness.getStatus() != null){
            queryWrapper.eq("status",viewZoneBusiness.getStatus());
        }
        return this.page(pageInfo,queryWrapper);
    }

    @Override
    public boolean addBusinessDetail(Integer id) {
        return viewZoneBusinessMapper.addBusinessDetail(id);
    }
}
